package com.example.parsing;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ConfigProperties {

    private static final Logger logger = LoggerFactory.getLogger(ConfigProperties.class);

    public static Map<String,String> readConfig(){

        try{
            Map<String,String> configMap = new HashMap<>();
      BufferedReader br = new BufferedReader(new FileReader("1.txt"));
            String s;
            while ((s = br.readLine())!=null){
                String [] strings = s.split("=");
                configMap.put(strings[0],strings[1]);
            }
            return configMap;
        }catch (Exception e){
            logger.error("-------------------读取配置文件出错"+e);
        }

        return null;
    }
    
    
    public static List<String> readTxtConfig(){
    	List<String> list = new ArrayList<>();
    	try{
      BufferedReader br = new BufferedReader(new FileReader("txtJson.txt"));
    		String s;
    		while ((s = br.readLine())!=null){
    			list.add(s);
		    }
    		return list;
	    }catch (Exception e){
    		logger.error("--------------读取txt的配置文件出错"+e);
	    }
    	return list;
    }


}
